home *** CD-ROM | disk | FTP | other *** search
- /* fileops.c : file operations for dynamic */
-
- #include "dec.h"
- #include "errors.h"
-
- char open_file(fp, operation)
- FILE **fp;
- char *operation;
- {
- SFReply reply;
- char filename[BUFSIZ];
- GetfileName(&reply);
- strcpy(filename, (char *)reply.fName);
- *fp = fopen(filename, operation);
- if (!(reply.good)) {
- fprintf(stderr, CANNOT_OPEN_FILE, filename);
- exit_cleanly(NO_ERROR, EXIT_FAILURE);
- }
- else return(TRUE);
- }
-
- /* The following routines deal with the filea. This is all using the Macintosh HFS. */
-
- /* GetfileName: read a file name usign the HFS */
- GetfileName(reply)
- SFReply *reply;
- {
- Point dlgPoint;
- Str255 defName = "\pDynamic Output";
- int numTypes = 1;
- dlgPoint.h = 100; /* position of the 'open' dialog box */
- dlgPoint.v = 100;
- SFPutFile (dlgPoint, "\pSave output file as…", defName, NIL_POINTER,
- reply);
- PtoCstr ((char *) (*reply).fName);
- /* convert from PASCAL to 'C' string */
- } /* GetfileName */
-
-